var app=angular.module('dzsw', ['pagination']);//定义模块
app.controller('shopController' ,function($scope,$controller,$http){
    $controller('baseController',{$scope:$scope});//继承
    //分页
    $scope.findPage=function(pageNum,pageSize){
        $http.post('../emp/pagelist.do?pageSize='+pageSize+'&pageNum='+pageNum,$scope.searchEntity).success(
            function(response){
                $scope.emplist=response.rows;
                $scope.paginationConf.totalItems=response.total;//更新总记录数
            }
        );
    }
    $scope.getDePts=function () {
        $http.get('../emp/getDePts.do').success(
            function(response){
                $scope.demplist=response;
            }
        );
    }
    $scope.getZhiweis=function () {
        $http.get('../emp/getZhiweis.do').success(
            function(response){
                $scope.zhiweilist=response;
            }
        );
    }
    $scope.getById=function(name,id){
        $scope.entity.name=name;
        $scope.entity.empid=id;
    }
    $scope.save=function () {
        $http.post('../emp/qingjia.do',$scope.entity).success(
            function(response){
                alert(response.success);
            }
        );
    }
    $scope.getxzmx=function (empid,name) {
        $http.get('../emp/xzmx/'+empid+'.do').success(
            function(response){
                $scope.xzmx=response.tXzmx;
                $scope.qingjialist=response.tQingjias;
                $scope.xzmx.name=name;
                angular.forEach($scope.qingjialist,function (qingjia) {
                    if(qingjia.qjtype == 1 || qingjia.qjtype == 2){
                        $scope.xzmx.dxday +=qingjia.tianshu;
                    } else{
                        $scope.xzmx.bdxday +=qingjia.tianshu;
                    }
                })
                if(($scope.xzmx.bdxday+$scope.xzmx.dxday)>0){
                    $scope.xzmx.qqj=0;
                }
                $scope.xzmx.ylbx=$scope.xzmx.gwsalary*0.03;
                console.log(response);
            }
        );
    }

});